<div class="page-content">
	<div class="row">
		<div class="col-xs-12"> 
	
			<div id="alert_box_table"></div>
			<div class="row">

				<div class="action-buttons" style="float:right;">
					<button id="add_nav" class="btn btn-sm btn-success" >
						<i class="icon-plus bigger-130"></i>
						<span class="bigger-110 no-text-shadow">新增</span>
					</button>
			

				</div>
			</div>

			<div class="space-4"></div>
			<div class="table-responsive">

				{:NW('Table',array(
						'columns'=>array(
							array('name'=>'nav_name','text'=>'导航名称','width'=>'12%'),
							array('name'=>'type','text'=>'类型','width'=>'10%','sortable'=>false),
							array('name'=>'nav_href','text'=>'链接','width'=>'12%','sortable'=>false),
							array('name'=>'nav_image','text'=>'图标','width'=>'12%','sortable'=>false),
							array('name'=>'sort','text'=>'排序','width'=>'8%','sortable'=>false),
							array('name'=>'status','text'=>'状态','width'=>'8%','sortable'=>false),
							array('name'=>'create_datetime','text'=>'创建时间','width'=>'10%','sortable'=>false),
							
						), 
						'default'	=> '空',
						'rows'		=> !is_array($rows) ? array() : $rows ,
						'button_width'	=>'15%',
						'button' 	=> array(
							0	=> array('class'=>'green', 'icon'=>'pencil', 'name'=>'edit_nav', 'title'=>'编辑', 'field'=>array('id', 'nav_id')),
							1	=> array('class'=>'red', 'icon'=>'trash', 'name'=>'del', 'title'=>'删除', 'field'=>array('id')),
							
						),
					) ,'Nav'
				)}

				
			</div>
			
			

		</div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$('#add_nav').click(function(){
			window.location.href = "{:U('Station/add_nav')}";
		});
		$("a[name='del']").click(function(){
			var id = $(this).attr('value');
			if (id == ''){
				$("#alert_box_table").jk_alert({msg: '没有获取到要删除的数据，请刷新后重试', type:'danger', show_time:12000});
				return false;
			}
			showdialog({
				'title':'提示',
				'message':'您确定要删除这个导航吗？',
				'okfunction':function(){
					$.ajax({ 
			            url: "{:U('Station/del_nav')}",  
			            data:{'id': id},
			            dataType:'json',
			            type:'POST',
			            success: function(data){
			                if (data.ret == 1){
			                    $("#alert_box_table").jk_alert({ msg: data.msg, type: 'success', show_time: 3500 });
			                    location.reload();
			                }else{
			                    $("#alert_box_table").jk_alert({ msg: data.msg, type: 'danger', show_time: 3500 });
			                }
			            }
			        });
				}
			})
		})
		$("a[name='edit_nav']").click(function(){
			var field = $(this).attr('value');
			if (field == ''){
				$("#alert_box_table").jk_alert({msg: '没有获取到要编辑的数据，请刷新后重试', type:'danger', show_time:12000});
				return false;
			}
			field = field.split('__');
			var id = field[0];

			var nav_id = field[1];
			if (id == '' && nav_id == ''){
				$("#alert_box_table").jk_alert({msg: '没有获取到要编辑的数据，请刷新后重试', type:'danger', show_time:12000});
				return false;
			}
			
			window.location.href = "{:U('Station/add_nav')}?id="+id+"&nav_id="+nav_id;
		});

	});
</script>
